﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UpanHelper2
{
    public partial class Form2 : Form
    {
        private DriveInfo drive;
        public Form2(DriveInfo drive)
        {
            InitializeComponent();
            this.drive = drive;
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            this.BackColor = Color.LightGray;
            //label1
            label1.Text = drive.VolumeLabel;
            //label3
            long long_x = drive.AvailableFreeSpace;//当前已经用的量
            double dou_x = long_x;
            dou_x /= 1024; dou_x /= 1024; dou_x /= 1024;

            long long_y = drive.TotalSize;//全部量
            double dou_y = long_y;
            dou_y /= 1024; dou_y /= 1024; dou_y /= 1024;
            label3.Text = dou_x.ToString("0.00") +"G可用，共"+dou_y.ToString("0.00") +"G的空间";

        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("explorer.exe", drive.Name);
        }

        private void Form2_MouseClick(object sender, MouseEventArgs e)
        {
            UpanManager.showTool(drive);
        }

        private void Form2_MouseEnter(object sender, EventArgs e)
        {
            this.BackColor = Color.DeepSkyBlue;
        }

        private void Form2_MouseLeave(object sender, EventArgs e)
        {
            this.BackColor = Color.LightGray;
        }
    }
}
